<h3>Lista porudzbina</h3>

<button class="btn btn-success" ng-click="izmeniPorudzbinu('novi')" data-toggle="modal" href="#editModal">
    <i class="icon-calendar icon-white"></i>
	&nbsp;Kreiraj novu porudžbinu
</button>

<div class="pull-right">
	<label >Pronađi porudžbinu: &nbsp;</label>
	<input ng-model="search.$" class="form-control"/>
</div>
<table id="searchObjResults" class='table table-striped'>
    <thead>
    <tr>
        <th>Porudžbina</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
    </tr>
    </thead>
    <tbody>
    <tr style="height: 45px;">
		<td>
			<label ng-click="orderByField = 'porudzbinaID'; reverseSort = !reverseSort">
				<b>ID</b>
				<span ng-show="orderByField == 'porudzbinaID'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		<td>
			<label ng-click="orderByField = 'datumPorudzbine'; reverseSort = !reverseSort">
				<b>Datum</b>
				<span ng-show="orderByField == 'datumPorudzbine'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		<td>
			<label ng-click="orderByField = 'razduzeno'; reverseSort = !reverseSort">
				<b>Razduženo</b>
				<span ng-show="orderByField == 'razduzeno'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		<td>
			<label ng-click="orderByField = 'napravljena'; reverseSort = !reverseSort">
				<b>Napravljena</b>
				<span ng-show="orderByField == 'napravljena'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		<td>
			<label ng-click="orderByField = 'ime'; reverseSort = !reverseSort">
				<b>Konobar</b>
				<span ng-show="orderByField == 'ime'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		<td>
			<label ng-click="orderByField = 'stoID'; reverseSort = !reverseSort">
				<b>Sto</b>
				<span ng-show="orderByField == 'stoID'">
					<span ng-show="!reverseSort" class="glyphicon glyphicon-chevron-down"></span>
					<span ng-show="reverseSort" class="glyphicon glyphicon-chevron-up"></span>
				</span>
			</label>
		</td>
		>
		</td>
		<td><b></b></td>
	</tr>
    <tr ng-repeat='porudzbina in porudzbine | filter:search:strict | orderBy:orderByField:reverseSort | startFrom:currentPage*pageSize | limitTo:pageSize'>
        <td>{{porudzbina.porudzbinaID}}</td>
        <td>{{porudzbina.datumPorudzbine}}</td>
        <td>{{porudzbina.razduzeno}}</td>
        <td>{{porudzbina.napravljena}}</td>
        <td>{{porudzbina.ime}} {{porudzbina.prezime}}</td>
        <td>{{porudzbina.stoID}}</td>
        <td><button role='button' class='btn btn-warning' ng-click="izmeniPorudzbinu(porudzbina);" data-toggle="modal" href="#editModal">Izmeni</button></td>
    </tr>
    <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
    <tr>
        <td >
            <button class="btn btn-success" ng-disabled="currentPage == 0" ng-click="currentPage=currentPage-1">
                <span class="glyphicon glyphicon-chevron-left"></span>Previous
            </button>
        </td>
        <td><h4>{{currentPage+1}}/{{5}}</h4></td>
        <td>
            <button class="btn btn-success" ng-disabled="currentPage >= data.length/pageSize - 1" ng-click="currentPage=currentPage+1">
                <span class="glyphicon glyphicon-chevron-right"></span>Next
            </button>
        </td>
        <td></td><td></td><td></td><td></td>
    </tr>
    </tbody>
</table>


<div ng-controller="PorudzbinaListCtrl" class="modal fade"  tabindex="-1" role="dialog" ng-include="'view/porudzbina-detalji.html'" id="editModal" aria-hidden="true"></div>
</div>